<template>
  <div>
    <el-form ref="form" :model="drugForm" label-width="80px">
      <el-form-item label="药品名称">
        <!--隐藏编号-->
        <input type="hidden" v-model="drugForm.drugId"></input>
        <!-- el-input  文本框-->
        <el-input v-model="drugForm.drugName"></el-input>
      </el-form-item>

      <el-form-item label="药品种类">
        <el-select v-model="drugForm.drugType" placeholder="药品种类">
          <el-option label="中药" value="中药"></el-option>
          <el-option label="西药" value="西药"></el-option>
          <el-option label="生物药剂" value="生物药剂"></el-option>
        </el-select>
      </el-form-item>

<!--      <el-form-item label="D:">-->
<!--        <el-input type="textarea" v-model="paperForm.quDoption"></el-input>-->
<!--      </el-form-item>-->

      <el-form-item label="药品数量">
        <el-input v-model="drugForm.drugQuantity"></el-input>
      </el-form-item>
      <el-form-item label="入库时间">
        <el-date-picker v-model="drugForm.storageTime" type="datetime" placeholder="选择日期时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="过期时间">
        <el-date-picker v-model="drugForm.expirationTime" type="datetime" placeholder="选择日期时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="功能描述">
        <el-input type="textarea" v-model="drugForm.drugDescription"></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="onSubmit">保存</el-button>
        <el-button @click="getBack">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
    import error from "./error";

    export default {
        name: "DrugEdit",
      data(){
        return{
          drugForm:{},//药品表单对象
        }
      },
      methods:{
        onSubmit(){
          var self = this;
          console.log(this.paperForm);
          //ajax提交
          this.$Request.fetch_("/api/drugManager/drug/update","post",this.drugForm)
          .then(function (rs) {
            self.$message("修改成功");
                  //回到表格页面
                  self.$router.replace("/Drug");
          }).catch((error)=>{
            self.$message(error);
          })
        },
        getBack(){
          this.$router.push("/Drug");
        }
      },
      created() {
        console.log(this.$route.query);
        this.drugForm = this.$route.query;
      }
    }
</script>

<style scoped>

</style>
